export interface ResponseData {
  code: number
  message: string
  ok: boolean
}

// TODO 需要修改
export interface SpuData {
  id?: number
  spuName: string
  description: string
  categoryId: number | string
  tmId: number | string
  spuSaleAttrList: null | SpuSaleAttrList
  spuImageList: null | SpuImageList
}

export type Records = SpuData[]

export interface SpuResponseData extends ResponseData {
  data: {
    records: Records
    total: number
    size: number
    current: number
    searchCount: boolean
    pages: number
  }
}

export interface Trademark {
  id: number
  tmName: string
  logoUrl: string
}

export type TrademarkList = Trademark[]

export interface AllTrademark extends ResponseData {
  data: TrademarkList
}

export interface SpuImage {
  id?: number
  createTime?: string
  updateTime?: string
  spuId?: number
  imgName?: string
  imgUrl?: string
  name?: string
  url?: string
}

export type SpuImageList = SpuImage[]

export interface SpuImageResponseData extends ResponseData {
  data: SpuImage[]
}
// 销售属性值
export interface SpuSaleAttrValue {
  id?: number | string
  createTime?: null
  updateTime?: null
  spuId?: number
  baseSaleAttrId: number | string
  saleAttrValueName: string
  saleAttrName?: string
  isChecked?: null
}
// 销售属性值列表
export type SpuSaleAttrValueList = SpuSaleAttrValue[]

// 销售属性
export interface SpuSaleAttr {
  id?: number | string
  createTime?: null
  updateTime?: null
  spuId?: number
  baseSaleAttrId: number
  saleAttrName: string
  spuSaleAttrValueList: SpuSaleAttrValueList
  flag?: boolean
  saleAttrValue?: string
}

export type SpuSaleAttrList = SpuSaleAttr[]
// 销售属性数据
export interface SpuSaleAttrResponseData extends ResponseData {
  data: SpuSaleAttr[]
}
// 基础销售属性
export interface BaseSpuSaleAttr {
  id: number
  name: string
}

export type BaseSpuSaleAttrList = BaseSpuSaleAttr[]
// 全部销售属性数据
export interface BaseSpuSaleAttrResponseData extends ResponseData {
  data: BaseSpuSaleAttr[]
}

export interface Attr {
  attrId: number | string
  valueId: number | string
}

export interface saleAttr {
  saleAttrId: number | string
  saleAttrValueId: number | string
}

export interface SkuData {
  category3Id: string | number //三级分类的ID
  spuId: string | number //已有的SPU的ID
  tmId: string | number //SPU品牌的ID
  skuName: string //sku名字
  price: string | number //sku价格
  weight: string | number //sku重量
  skuDesc: string //sku的描述
  skuAttrValueList?: Attr[]
  skuSaleAttrValueList?: saleAttr[]
  skuDefaultImg: string //sku图片地址
}

export interface SkuInfoData extends ResponseData {
  data: SkuData[]
}
